// Click Project | Add COM Wrapper
//   Select Inside COM+ Component Type Library and click OK
// Then build this Java project

import component.*;
import com.ms.com.ConnectionPointCookie;

public class JavaSink implements IOutGoing
{
    public void GotMessage(int Message)
    {
        System.out.println((char)Message);
    }
}

class Driver
{
    public static void main(String[] args)
    {
        ISum ref = (ISum)new component.InsideCOM();
        System.out.println("8 + 9 = " + ref.Sum(8, 9));
		
        try
        {
            JavaSink j = new JavaSink();
            ConnectionPointCookie EventCookie = new 
                ConnectionPointCookie(ref, j, 
                Class.forName("component.IOutGoing"));
            System.out.println("Press Enter to exit.");
            System.in.read();
        }
        catch(Exception e)
        {
        }
    }
}